package top.rushpeak.edu03.admin.web.admin;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.render.JsonRender;

import top.rushpeak.edu03.admin.web.BaseController;
import top.rushpeak.edu03.core.util.StringUtil;




/**
 * 圖片-鏈接設置
 * @author wesleyxw
 *
 * 2017年3月18日
 */
public class ImageController extends BaseController {

	//首页图片配置
	public void index() {
		render("image.html");
	}
	
	public void imageData(){
		int pageNum = getParaToInt("page", 1);
		int rows = getParaToInt("rows", 30);
		pageNum = pageNum > 0 ? pageNum : 1;
		String whereSql = " WHERE 1=1 ";
		if (!StringUtil.isEmpty(getPara("image_type")))
			whereSql += " and image_type = " + getPara("image_type");
		Page<Record> page = Db.paginate(pageNum, rows, "select *",
			"from `show_image`" + whereSql + " order by id ");
		
		render(new JsonRender().forIE());
	}
	

}
